<div id="form"></div>
<script>
var frm=$("#form").ajajform({
	header: null,
	footerButtons: [
		{value: "create",url: "/admin-guestbook_messages/?mode=edit&guestbook_id={{fields.guestbook_id}}"}
	]
});
var grid=frm.ajajform("insertWidget",null,null,{
	type: "grid",
	title: "{{!title}}",
	name: "messages",
	rowClasses: [{
		name:"messages",
		columns: [
			{name: "date", label: "{{!col_date}}", width: 150, url: '{{action}}?mode=edit&guestbook_id={{fields.guestbook_id}}&message_id='},
			{name: "phone", label: "{{!col_telephone}}", width: 150 },
			{name: "email", label: "{{!col_email}}", width: 150},
			{name: "message", label: "{{!col_message}}", width: 150 },
			{name: "user_a_name", label: "{{!col_user_a_name}}", width: 150 },
			{name: "moderated", label: "{{!col_moderated}}", width: 100, type: "checkbox"}
		]
	}]
});
var messages={{JSON:messages}};
for (var i=0;i<messages.length;i++) {
	var t=messages[i];
	grid.ajajform_grid("insertRow",null,{rowClass: "messages",cells:[t.date_question,t.user_q_phone,t.user_q_email,t.question,t.user_a_name,t.moderated],id:t.id});
}
</script>




